package com.hdc.service;

import com.hdc.HealthDeviceRemote;
import com.hdc.dao.BodyPassPoDao;
import com.hdc.po.BasePo;
import com.hdc.po.BodyPassPo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by chenyq5 on 2016-11-14.
 */
@Service("bodyPassImpl")
public class BodyPassImpl extends BaseService implements HealthDeviceRemote  {

protected  final  static Logger log = LoggerFactory.getLogger(BodyPassImpl.class);

    @Autowired
    private BodyPassPoDao bodyPassPoDao;

    public boolean saveOrUpdate(BasePo bodyPassPo) {
       boolean result =false;

            Integer bodypass_id = ((BodyPassPo) bodyPassPo).getBodypass_id();
            if (bodypass_id==null){
                int insert = bodyPassPoDao.insert((BodyPassPo) bodyPassPo);
            }else {
                bodyPassPoDao.updateByPrimaryKey((BodyPassPo) bodyPassPo);
            }


        return result;
    }


    public boolean saveTx() throws Exception{
             BodyPassPo p1=new BodyPassPo();
             p1.setBodypass_id(123);
             BodyPassPo p2 =new BodyPassPo();
             p2.setMname("tx");
             bodyPassPoDao.insert(p2);
             bodyPassPoDao.insert(p1);
             return true;


    }
}
